//
//  ZMyAskAlreadyView.m
//  DoctorFAQs
//
//  Created by zjq on 17/2/20.
//  Copyright © 2017年 zjq. All rights reserved.
//

#import "ZMyAskAlreadyView.h"
#import "ZConsultTableViewCell.h"
static NSString * const KZMyAskAlreadyIdentifier = @"KZMyAskAlreadyIdentifier";
@interface ZMyAskAlreadyView ()<UITableViewDelegate,UITableViewDataSource> {
    UITableView * _mainTableView;
}

@end
@implementation ZMyAskAlreadyView

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self initlizeInterface];
    }
    return self;
}
- (void)initlizeInterface {
    _mainTableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
    _mainTableView.dataSource = self;
    _mainTableView.delegate = self;
    _mainTableView.rowHeight = 160*ysIZE;
    [_mainTableView registerClass:[ZConsultTableViewCell class] forCellReuseIdentifier: KZMyAskAlreadyIdentifier];
    [self addSubview:_mainTableView];
    [_mainTableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self);
    }];
}
// 表格视图协议
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 5;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    ZConsultTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:KZMyAskAlreadyIdentifier forIndexPath:indexPath];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.cancelBtn.hidden = YES;
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (self.alreadyDelegate &&[self.alreadyDelegate conformsToProtocol:@protocol(ZMyAskAlreadyDelegate)]) {
        [self.alreadyDelegate selectAlreadyWith:indexPath.row];
    }
}

@end
